/**
 * 
 * Opened Touchable RIA Framework - A Web RIA Javascript Framework
 * 
 * Copyright (c) 2012
 * Dual licensed under the MIT or GPL v2 licenses.
 * 
 * @author  CuTe_CuBe
 * @version $Id: rect.js 6 2012-03-10 12:51:49Z cc.hgfeng@gmail.com $
 */

/**
 * OTR.Graph.Text
 * 提供绘图
 * 
 * @class OTR.Graph.Text
 * @constructor
 * @param object params
 * 矩形参数类型
 * borderRadius:  圆角
 */
OTR.Graph.Text = OTR.extend(OTR.Graph.Shape, {

     /**
      * 初始化对象
      * 
      * @param object params
      */
     _init: function(params) {
         this._addAttrs({
             text: '', 
             fontFamily: 'Arial',
             fontSize: '12px',
             color: '#000000',
             textAlign: 'start',
             borderWeight: 0,
             baseLine: 'top',
             maxWidth: 0,
         });
         this._setName('Text');

         OTR.Graph.Rect.__super._init.call(this, params);

         var a = this._attrs,
             s = parseInt(a.fontSize);
         a.width  = Math.min(s * a.text.length, a.maxWidth);
         a.height = s;
     }
});